<php>
		$order = service('Order')->get4UserById($order_id);
		$productdata	= service('Product')->getByShelfId($order['shelf_id']);
		
		/** 查询相应支付信息 **/
		if($order['enable']=='Y'){
			$paylist = service('Pay')->selectItemPay($order_id,'pay_order','Y','Y');
		}
		
		/** 礼券数据 **/
		$couponlist = service('Coupon')->select4UserByOrderId($order_id);
</php>

<link href="__PUBLIC__/Css/orderDetail.css" rel="stylesheet" type="text/css" />


<div id="payment">
	

				  	<!--第二步，编辑发送的彩信信息内容-->
					<div class="step">
				        <div class="cont">
							<div class="panel_style1">
							  	<div class="panel-title">
							         <ul class="column-tab">
							            <li class="tab-title tab-title-current" rel='edit'>基本信息</li>
							         </ul>
							    </div>

								<div class="receiverInfo">	
									<div style="float: left;text-align: center;width:170px;height:170px;margin:10px;overflow: hidden;border: 10px solid #EBEBEB;">
										<a href="{:U('Product://Index/detailp',array('shelfid'=>$productdata['shelf_id']))}">
											<img src="{:getPhotoFromThumb($productdata['goods_icon'],200,200)}" style="width:170px;height:170px;" title="商品图片！">   
										</a>	
									</div>	
					                <table class="receiver" id="order_receivers" border="0" cellspacing="0" cellpadding="0" 
					                	style="float:right;width: 500px;font-size:12px;text-align:left">
					                    <colgroup>
					                        <col width="50%"><col width="">
					                    </colgroup>
					                    <tbody>
					                    	<tr>
					                        	<td><font style="font-weight: bold;">订单编号：</font>
						                            {$order['id']}
					                            </td>
					                            <td><font style="font-weight: bold;">商品编号：</font>
					                            	{$productdata['goods_id']}
					                            </td>
					                        </tr>
					                    	<tr>
					                        	<td><font style="font-weight: bold;">商品品牌：</font>
						                            <a href="{:U('Product://Brand/detail',array('bid'=>$productdata['partner_id']))}">{$productdata['partner_title']}</a>
					                            </td>
					                            <td><font style="font-weight: bold;">商品名称：</font>
					                            	<a href="{:U('Product://Index/detailp',array('shelfid'=>$productdata['shelf_id']))}">{$productdata['goods_title']}</a>
					                            </td>
					                        </tr>
					                        <tr>
					                        	<td><font style="font-weight: bold;">送者名称：</font>
					                            	{$order['sender_name']}
					                            </td>
					                            <td><font style="font-weight: bold;">送者手机：</font>
						                            {$order['sender_mobile']}
					                            </td>
					                        </tr>
					                        
					                        <tr>
					                        	<td><font style="font-weight: bold;">购买单价：</font>
					                            	{:formatMoney($productdata['shelf_out_price'])}
					                            </td>
					                            <td><font style="font-weight: bold;">购买数量：</font>
						                            {$order['quantity']}&nbsp;件
					                            </td>
					                        </tr>
					                        <!--  
					                        <tr>
					                        	 <td><font style="font-weight: bold;">获赠积分：</font>
					                            	{$order['gain_credit']}
					                            </td>
					                             <td><font style="font-weight: bold;">使用积分：</font>
					                            	{$order['used_credit']}
					                            </td>
					                        </tr>
					                        -->
					                        <tr>
					                            <td><font style="font-weight: bold;">是否支付：</font>
						                            <font style="color:red">{:payStateDesc($order['pay_state'])}</font>
					                            </td>
					                            <td><font style="font-weight: bold;"><php>if($order['pay_state']=='pay'){</php>已付金额：<php>}else{</php>需付金额：<php>}</php></font>
						                           	 {:formatMoney($order['paid_money'])}
					                            </td>
					                        </tr>
					                        <tr>
					                            <td><font style="font-weight: bold;">有效时间：</font>
						                            <font style="color:red">{:exchangeTimeDesc($order_data['shelf']['shelf_exchange_time'])}</font>
					                            </td>
					                            <td>
					                            </td>
					                        </tr>
					                        
					                    </tbody>
					                </table>
					                <div class="clear"></div>
				            	</div>  
				           	</div>
				         </div>
				         
				         <php>if(!empty($paylist)){</php>  
							<!--第二步，编辑发送的彩信信息内容-->
					        <div class="cont">
								<div class="panel_style1">
								  	<div class="panel-title">
								         <ul class="column-tab">
								            <li class="tab-title tab-title-current" rel='edit'>支付记录</li>
								         </ul>
								    </div>
	
									<div class="receiverInfo">		
						                <table class="receiver" id="order_receivers" border="0" cellspacing="0" cellpadding="0" 
						                	style="width: 100%;font-size:12px;text-align:left">
						                    <colgroup>
						                        <col width="20%"><col width="20%"><col width="20%"><col width="20%"><col width="">
						                    </colgroup>
						                    <tbody>
						                        <tr style="height:22px">
						                        	<td style="text-align:center"><font style="font-weight: bold;">交易ID</font></td>
						                            <td style="text-align:center"><font style="font-weight: bold;">支付方式</font>
						                            </td>
						                            <td style="text-align:center"><font style="font-weight: bold;">支付金额</font>
						                            </td>
						                            <td style="text-align:center"><font style="font-weight: bold;">支付时间</font>
						                            </td>
						                        </tr>
						                        
						                        <php>
						                        $_total_pay = 0;
						                        $tmp_paymentdict = service('Dict')->getAllDictKeyValueByCode('payprovider');
						                        foreach( $paylist as $vo ){</php>
							                        <tr style="height:22px">
							                        	<td style="text-align:center">{$vo['trade_no']}</td>
							                            <td style="text-align:center">{$tmp_paymentdict[$vo['service']]}</td>
							                            <td style="text-align:center">{:formatMoney($vo['total_fee'])}</td>
							                            <td style="text-align:center">{:paramMillisecond2Date($vo['paytime'],'Y-m-d H:i')}</td>
							                        </tr>
						                      	<php>
						                      	$_total_pay = $_total_pay*1+$vo['total_fee']*1;
						                      	}</php> 
						                      	<php>if($order['used_credit']>0){</php>
						                      		<tr style="height:30px">
							                        	<td>----</td>
							                        	<!--  
							                            <td>积分支付</td>
							                            -->
							                            <td>----</td>
							                            <td>{$order['used_credit']}/100={:formatMoney($order['used_credit']/100)}</td>
							                            <td>{:paramMillisecond2Date($vo['ctime'],'Y-m-d H:i')}</td>
							                        </tr>
						                      	<php>}</php> 
						                      	
						                      		<tr style="height:22px">
							                        	<td colspan='6' style="text-align:right;font-weight:bold;font-size: 14px;height: 30px;">
							                        	<font style="color:red">{:payStateDesc($order['pay_state'])}</font>
							                        	&nbsp;&nbsp;&nbsp;
														<php>if($order['pay_state']=='pay'){</php>
														合计：
														&nbsp;&nbsp;&nbsp;&nbsp;
														共：{:formatMoney($productdata['shelf_out_price']*$order['quantity'])}
														&nbsp;&nbsp;&nbsp;&nbsp;
														<php>}else{</php>
														总金额：{:formatMoney($productdata['shelf_out_price']*$order['quantity'])}
														&nbsp;&nbsp;&nbsp;&nbsp;
														已付金额：{:formatMoney($_total_pay)}
														&nbsp;&nbsp;&nbsp;&nbsp;
														还需支付：{:formatMoney( $productdata['shelf_out_price']*$order['quantity'] - $_total_pay )}
														&nbsp;&nbsp;&nbsp;&nbsp;
														<php>}</php>
														
					                            		</td>
							                        </tr>
  
						                    </tbody>
						                </table>
					            	</div>  
					           	</div>
					        </div>
						<php>}</php>  
						
						
						<!--第二步，编辑发送的彩信信息内容-->
					        <div class="cont">
								<div class="panel_style1">
								  	<div class="panel-title">
								  		<span style="float:right; margin-right: 10px;cursor: pointer;" title="点击查看短信/彩信发送的内容！"
								  			onclick="k_show( '{:U('Product://Order/giftSendInfo')}',{ order_id: '{$order['id']}' },'发送内容')">发送内容</span>
								        <ul class="column-tab">
								        	<li class="tab-title tab-title-current" rel='edit'>发送记录</li>
								        </ul>
								    </div>
	
									<div class="receiverInfo">		
						                <table class="receiver" id="order_receivers" border="0" cellspacing="0" cellpadding="0" 
						                	style="width: 100%;font-size:12px;text-align:left">
						                    <colgroup>
						                        <col width="20%"><col width="20%"><col width="20%"><col width="20%"><col width="">
						                    </colgroup>
						                    <tbody>
						                        <tr style="height:25px">
						                        	<td style="text-align:center"><font style="font-weight: bold;">手机号码</font></td>
						                            <td style="text-align:center"><font style="font-weight: bold;">商品数量</font></td>
						                            <td style="text-align:center"><font style="font-weight: bold;">发送方式</font></td>
						                            <td style="text-align:center"><font style="font-weight: bold;">发送日期</font></td>
						                            <td style="text-align:center"><font style="font-weight: bold;">发送状态</font></td>
						                        </tr>
						                    	<php>
						                    	foreach($couponlist as $data_){
						                    	</php>
						                    		<tr style="height:22px" id='receiver_{$data_['id']}'>
						                    		
							                        	<td style="text-align:center">{$data_['receiver_mobile']}</td>
							                            <td style="text-align:center">{$data_['quantity']}</td>
							                            <td style="text-align:center">{:getChanelDesc($data_['channel'])}</td>
							                            <php>$_tmp_copnstatus = getSendStatus($data_);</php>
							                            <td style="text-align:center">{$_tmp_copnstatus['target_time']}</td>
							                            <td style="text-align:center">
								                            <img 	src="/Public/Images/global/{$_tmp_copnstatus['icon']}" 
								                            		id='send_state_{$data_['id']}'
								                            		title="{$_tmp_copnstatus['desc']}" >
								                            
								                            <php>if($order['pay_state']=='pay'){
								                            		$sendRole_ = $order['user_id']==$user['id']?'sender':'receiver';
								                            </php>
								                            &nbsp;&nbsp;
								                            <span title="重新发送{:K('SP_COUPON_NM')}！最多3次（接收者和送礼者总共可发3次），已发送{$data_['send_times']}次！" class="cursor" style="color: #339900;"
								                            		onclick="resendCoupon( '{:U('User://Index/resendCoupon')}' ,{ id:'{$data_['id']}' , oid:'{$data_['order_id']}' ,sendRole:'{$sendRole_}' } )">
								                            		重新发送
								                            </span>
							                            	<php>}</php>
							                            </td>
							                        </tr>
						                       <php>}</php>
						                    </tbody>
						                </table>
					            	</div>  
					           	</div>
					        </div>
					  </div>
					  
					  
			<php>if($order['pay_state']!='pay'&&$order['enable']=='Y'){</php>
				<!--第三步，支付 style="vertical-align: top;padding-top:5px"-->
				<div class="step">
					    <div class="cont">
					    	<span style="float:right;margin-top: 5px;">请选择支付方式！</span>
					  		<h2 class="subStep">选择支付方式</h2>
					  		<div class="panel_style2">
								<php>
								//初始化相关变量
								$pb_paymentData=array(	'itemType'=>'pay_order'//支付类型，订单支付'pay_order'或账户冲值'pay_charge'
														,'itemId'=>$order['id']//对应订单支付'order'或账户冲值'charge'支付的对象id
														,'payType'=>$_REQUEST['paytype']//选择的支付类型
														,'payAmount'=>$order['paid_money']//需支付的现金总数，现金帐户支付时使用
														,'jsfun_afterPaySuccess'=>'showOrderDetail'//支付成功后执行的js函数,该函数有一个参数itemId
														,'jsfun_afterPayFailed'=>''//支付失败后执行的js函数,该函数有一个参数itemId
													);
								</php>
								<include file="../Index/Tpl/default/Pay/pay_box.html" />
							</div>
						</div>
				</div>
			<php>}</php>
			
</div>